package com.example.demo.mapper;

import com.example.demo.entity.LikesInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

@Mapper
public interface LikesMapper {

    /**
     * 添加点赞数据
     * @param likesInfo
     * @return
     */
    Integer add(LikesInfo likesInfo);

    /**
     * 通过 uid 和 aid 查询点赞信息是否存在
     * @param uid
     * @param aid
     * @return
     */
    LikesInfo queryLikesInfoByUidAndAid(@Param("uid") Integer uid,
                                      @Param("aid") Integer aid);

    /**
     * 修改点赞数据
     * @param likesInfo
     * @return
     */
    Integer updateStateByLikesInfo(LikesInfo likesInfo);

    /**
     * 根据文章 id 删除对应的点赞数据
     * @param aid
     * @return
     */
    Integer delLikesInfoByAid(@Param("aid") Integer aid);

}
